<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateVisitsTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('visits', function(Blueprint $table)
		{
			$table->increments('id');
			$table->integer('visitorable_id')->comment('访客ID');
			$table->string('visitorable_type', 60)->comment('访客类名');
			$table->integer('hostable_id')->comment('受访者ID');
			$table->string('hostable_type', 60)->comment('受访者类名');
			$table->integer('type')->unsigned()->default(0)->comment('访问类型ID 参考 visit_types 表 ID');
			$table->string('remark')->nullable()->comment('备注');
			$table->string('description')->comment('描述');
			$table->text('data', 65535)->nullable()->comment('JSON 类型额外数据');
			$table->timestamps();
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('visits');
	}

}
